

package com.hazelcast.client.util;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientNetworkConfig;
import com.hazelcast.client.config.RoutingMode;

/**
 * Utility for creating and modifying {@link ClientConfig} instances
 * based on {@link RoutingMode} quickly and easily.
 */
public class ConfigRoutingUtil {

    /**
     * Creates a new {@link ClientConfig} instance configured to use the
     * provided {@link RoutingMode}.
     *
     * @param routingMode the {@link RoutingMode} to use for this config
     * @return a new {@link ClientConfig} configured to the provided {@link RoutingMode}
     */
    public static ClientConfig newClientConfig(RoutingMode routingMode) {
        ClientConfig clientConfig = new ClientConfig();
        ClientNetworkConfig networkConfig = clientConfig.getNetworkConfig();
        networkConfig.getClusterRoutingConfig().setRoutingMode(routingMode);
        return clientConfig;
    }
}
